#ifndef ODBCTESTS_MYSQL_TEST_FIXTURE_HPP
#define ODBCTESTS_MYSQL_TEST_FIXTURE_HPP

#include "odbc/connection.hpp"
#include "odbc/environment.hpp"

namespace odbc_tests
{

/// \ingroup odbc_tests
/// \brief Helper class, for setting up a working database connection for MySQL.
///
/// To have a successful connection, it expects to have a DSN called "mysql_odbc_tests".
class mysql_test_fixture
{
public:
	/// \brief It creates the ODBC connection and opens it.
	mysql_test_fixture( bool autoCommit = false)
		: connectionString_( "DSN=mysql_odbc_tests") 
		, environment_( 3)
		, connection_( environment_, connectionString_, 10, autoCommit)
	{ 
	}

	/// \brief It gets the ODBC connection to be used by test cases.
	odbc::connection& conn() { return connection_; }

	/// \brief It gets the ODBC environment to be used by test cases.
	odbc::environment& env() { return environment_; }
	
private:
	std::string connectionString_;
	odbc::environment environment_;
	odbc::connection connection_;
};


} // namespace odbc_tests

#endif // ODBCTESTS_MYSQL_TEST_FIXTURE_HPP